package com.eatme.web.security.authentication.password.provider;

import com.eatme.web.security.authentication.emailcode.provider.EmailCodeAuthenticationProvider;
import com.eatme.web.security.authentication.password.service.impl.UserPasswordSecurityUserServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.password.PasswordEncoder;

public class RestAuthenticationProvider extends DaoAuthenticationProvider {



    private static final Logger LOG = LoggerFactory.getLogger(EmailCodeAuthenticationProvider.class);

    public RestAuthenticationProvider(UserPasswordSecurityUserServiceImpl usernamePasswordSecurityUserServiceImpl, PasswordEncoder passwordEncoder) {
//        super();
//        super.setUserDetailsService();
//        super.setPasswordEncoder();
        setUserDetailsService(usernamePasswordSecurityUserServiceImpl);
        setPasswordEncoder(passwordEncoder);
    }

    // 在这里获取request 通过request来获取验证码 做比对

    @Override
    protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
        super.additionalAuthenticationChecks(userDetails, authentication);
    }
}
